<?php

namespace app\schoolwall\controller;

use think\Controller;

class Active extends Controller
{
    protected $ActiveModel = null;

    protected function _initialize()
    {
        $this->ActiveModel = model('common/Active/Active');
    }

    // 获取帖子列表
    public function getactivelist()
    {
        if ($this->request->isPost()) {
            $page = $this->request->param('page', 1, 'trim');
            $limit = $this->request->param('limit', 10, 'trim');
        }

        $count = $this->ActiveModel->count();
        $item = $this->ActiveModel->order('createtime desc')->page($page, $limit)->select();

        $data = [
            'count' => $count,
            'item' => $item,
        ];


        if ($item) {
            $this->success('刷新成功', '', $data);
        } else {
            $this->error('活动列表刷新失败失败');
        }
    }
}
